<template>
    <div class="driver-kanban">
        <Dispatch-data  v-model="objData"/>
        <div style="padding: 0 16px;background-color: #fff">
            <lar-table
                    model="user.driver"
                    canAdd="canAdd"
                    action="base.table"
                    class="border"
            ></lar-table>
            <!--action="base.table.driver_look"-->
        </div>
    </div>
</template>
<script>
    import DispatchData from './dataShow/DataShow.vue'
    export default {
        components: {
            DispatchData
        },
        data() {
            return {
                objData: [],
                newApi: 'user/driver_count'
            }
        },
        computed: {
            dataRefreshDialog() {
                return this.$store.state.num;
            },
        },
        watch: {
            dataRefreshDialog: function(newValue) {
                this.getStatisticsData();
            },
        },
        mounted() {
            this.getStatisticsData();
        },
        methods: {
            getStatisticsData() {  // 获取统计数据
                this.$http.get(this.newApi)
                    .then((response) => {
                        this.objData = response.data.data;
                    })
                    .catch((error) => {
                        if (error.response.data.msg) {
                            this.$message.error(error.response.data.msg);
                        } else {
                            this.$message.error('请求错误：' + error.response.status);
                        }
                    });
            },

        }
    }
</script>
<style lang="less">
    .driver-kanban{
        margin: 10px;
        .dispatch-early-warning{
            box-sizing: border-box;
            font-size: 20px;
            padding:6px 0 6px 25px;
            margin-bottom: 2px;
            background-color: #fff;
        }
    }
</style>

